1. Field of the Invention
The present invention relates generally to computer graphics. More particularly, the present invention relates to systems and methods of controlling precompiled computer programs in computer graphics systems.
2. Background Art
Prior art computer graphics systems typically execute an application program, such as a computer video game program, to generate graphics images for display on a computer screen. One type of prior art computer graphics system includes an on-line compiler. In this type of computing system, the computer graphics system compiles portions of the application program while executing other portions of the application program in real time. In this way, a first portion of the application program executing in the computer graphics system can provide run time parameters for compiling a second portion of the application program.
In some situations, a portion of the application program written specifically for graphics hardware in the computer graphics system can be simplified by using run time parameters during compilation. For instance, a first portion of the application program may include a loop construct having a loop count parameter, and the compiler can unroll the loop construct based on a value of the loop count parameter provided by a second portion of the application program at run time. Including a compiler in the computer graphics system, however, increases the cost and complexity of the graphics computer system.
Another type of prior art computer graphics system executes precompiled application programs. In this type of computer graphics system, an application program is compiled into binary programs by using an off-line compiler. The binary programs are then provided to the computer graphics system, which executes the binary programs. Precompiling the application program avoids the need for an on-line compiler but may complicate portions of the application program written specifically for graphics hardware in the computer graphics system. Specifically, these portions of the application program may require fixed parameters at compile time.
One type of program typically found in an application program written for a computer graphics system is a shader. A shader generates visual effects for graphics objects. In many computer graphics systems, the shader controls multiple texture units in the graphics hardware, each of which can access samples from a texture. Moreover, the shader generates colors for the graphics object based on the textures accessed from the texture units.
Some shaders require a greater number of textures for creating a visual effect than the number of texture units available in the graphics hardware of a computer graphics system. Consequently, some compilers cannot compile these application programs for these computer graphics systems. Other compilers generate a multi-pass shader by breaking up the task of creating a visual effect into passes such that each pass requires no more texture units than the number of texture units available in the computer graphics system. Each pass of the multi-pass shader performs an operation on a graphics to generate a result. In this way, a pass of the multi-pass shader may perform an operation based on a result generated in a previous pass.
In those types of computer graphics systems that compile programs on-line, an application program can modify parameters of a shader to configure the shader at run time, which may simplify the task of programming the shader. In contrast, those computer graphics systems that rely on an off-line compiler may need to fix some parameters of the shader at the time of compilation (i.e., compile time). Consequently, the shader (i.e., the precompiled shader) is not configurable at run time, which may complicate the task of programming the shader.
In light of the above, there exists a need to simplify the task of programming a multi-pass shader. Additionally, these exists a need for a precompiled multi-pass shader that is configurable at run time.